package cn.lili.modules.member.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.member.entity.dos.CityDistribution;
import cn.lili.modules.member.entity.dos.CityDistributionCancel;
import cn.lili.modules.member.entity.dto.CityDistributionDTO;
import cn.lili.modules.member.fallback.CityDistributionFallback;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.USER_SERVICE, contextId = "city-distribution", fallback = CityDistributionFallback.class)
public interface CityDistributionClient {
    @GetMapping("/feign/getCityDistributionById")
    CityDistribution getCityDistributionById(@RequestParam String id);

    @PostMapping("/feign/getCityDistribution")
    @ApiOperation("查询城主列表")
    Page<CityDistribution> getCityDistribution(@RequestBody CityDistributionDTO dto);

    /**
     * 创建城主
     * @param cityDistribution 城主对象
     * @return 是否成功
     */
    @PostMapping("/feign/createCityDistribution")
    Boolean createCityDistribution(@RequestBody CityDistribution cityDistribution);

    /**
     * 更新城主信息
     * @param city
     * @return
     */
    @PostMapping("/feign/updateCityDistributionById")
    Boolean updateCityDistributionById(@RequestBody CityDistribution city);

    /**
     * 初始化城主信息
     */
    @GetMapping("/feign/initCityDistribution")
    void initCityDistribution();

    @GetMapping("/feign/getCityDistributionByDistrictCodeAndMonthDate")
    CityDistribution getCityDistributionByDistrictCodeAndMonthDate(@RequestParam String regionId);

    /**
     * 获取本月区域取消资格记录
     * @param regionId 区域
     * @return 本月区域取消资格记录
     */
    @GetMapping("/feign/getCityDistributionCancelByRegion")
    List<CityDistributionCancel> getCityDistributionCancelByRegion(@RequestParam String regionId);

}
